/**
 * 
 * @param key 设置缓存数据
 * @param data 
 */
export const setStorage = (key: string, data: any) => {
  if (key && (data && data !== 0)) {
    localStorage.setItem(key, JSON.stringify(data));
  }
}
/**
 * 
 * @param key 获取缓存数据
 * @returns 
 */
export const getStorage = (key: string) => {
  const data = localStorage.getItem(key);
  return (!!data && !['null', 'undefined'].includes(data)) ? JSON.parse(data) : null;
}
/**
 * 移除单个缓存
 * @param key 
 * @returns 
 */
export const removeStorage = (key: string) => {
  localStorage.removeItem(key);
}
/**
 * 移除所有缓存
 */
export const removeAll = () => {
  localStorage.clear();
}